class Solution(object):
    def reverse(self, x):
        """
        :type x: int
        :rtype: int
        """
        res = int(str(x)[::-1].strip('-'))
        x =  res if x > 0 else -res
        return x if -2147483648 < x < 2147483647 else 0